package com.zhfk.common.result;

import lombok.AccessLevel;
import lombok.Data;
import lombok.Setter;

@Data
@Setter(AccessLevel.NONE)
public class ResponseResult<T> {
    /**
     * 返回码
     */
    private Integer code;
    /**
     * 数据
     */
    private T data;

    public ResponseResult(Integer code, T data) {
        this.code = code;
        this.data = data;
    }

    public static <T> ResponseResult<T> success(Integer code, T data) {
        return new ResponseResult<>(code, data);
    }

    public static <T> ResponseResult<T> success(T data) {
        return new ResponseResult<>(200, data);
    }

    public static <T> ResponseResult<T> failed(Integer code, T data){
        return new ResponseResult<>(code, data);
    }
}